package com.xiaoq.matrix.repository.impl;

import org.mongodb.morphia.Datastore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.xiaoq.coms.util.IdGeneratorUtils;
import com.xiaoq.matrix.entity.TourismContentEntity;
import com.xiaoq.matrix.repository.ITourismContentRepository;

@Repository
public class TourismContentRepositoryImpl implements ITourismContentRepository {
	
	private static final Logger LOG = LoggerFactory.getLogger(TourismContentRepositoryImpl.class);
	@Autowired
	private Datastore dataStore;

	@Override
	public TourismContentEntity save(TourismContentEntity tourismContent) {
		LOG.info("添加的文章"+tourismContent.toString());
		dataStore.save(tourismContent);
		return tourismContent;
	}

	@Override
	public TourismContentEntity findById(String id) {
		return dataStore.find(TourismContentEntity.class).field(IdGeneratorUtils.IDGENERATOR).equal(id).get();
	}

}
